<!DOCTYPE HTML>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<title>jQuery File Upload Example</title>


<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/uploadify/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/uploadify/jquery.uploadify.v2.1.4.min.js"></script>
</head>
<body>

<script type="text/javascript">
function inArray(needle, haystack) {
    var length = haystack.length;
    for(var i = 0; i < length; i++) {
        if(haystack[i] == needle) return true;
    }
    return false;
}

$(document).ready(function() {

  $('#file_upload').uploadify({
    'uploader'  : '/uploadify/uploadify.swf',
    'script'    : '/uploadify/uploadify.php',
    'cancelImg' : '/uploadify/cancel.png',
    'folder'    : 'uploads',
    'auto'      : true,
	'fileExt'        : '*.jpg;*.gif;*.png',
	'multi'       : true,
	'queueID' : 'custom-queue',
	'removeCompleted' : false,
	'onSelectOnce'   : function(event,data) {
			 // $('#status-message').text(data.filesSelected + ' files have been added to the queue.');
				},
		  'onAllComplete'  : function(event,data) {

			  $('#status-message').text(data.filesUploaded + ' files uploaded, ' + data.errors + ' errors.');
			},
		

		'onSelect' : function (event, queueID, fileObj) {
					var ext = fileObj.name;
					ext = ext.substr(ext.length-3); //gets last 3 chars (extention type)
					var exts=new Array('jpg','gif','png');
					if(inArray(ext,exts)==false)
					{
					//alert("Not a valid .TIFF file");
					$jQuery('#file_upload').uploadifyCancel(queueID);
					//$jQuery('#file_upload').uploadifySettings('script','/uploadify/uploadify-x.php');
					return false;
					}
					return true;
					
					},	
		'onError'     : function (event,ID,fileObj,errorObj) {
		alert(errorObj.type + ' Error: ' + errorObj.info);
					}
	   
  });
});
</script>


<form  action="" method="post"  enctype="multipart/form-data">

  <div id="status-message">Select some files to upload:</div>
		
		<input id="file_upload" name="file_upload" type="file" />
		<div id="custom-queue"></div>
		<input type="submit" value="ok"/>
</form>
	</body>
	</html>